/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package RMCA;

import com.sap.conn.jco.ext.DestinationDataProvider;
import java.io.File;
import java.io.FileOutputStream;
import java.util.Properties;

/**
 *
 * @author XPIT140
 */
public class StepByStepClient {
    static String DESTINATION_NAME1 = "ABAP_AS_WITHOUT_POOL";
    static String DESTINATION_NAME2 = "ABAP_AS_WITH_POOL";
    static
    {
        Properties connectProperties = new Properties();
        connectProperties.setProperty(DestinationDataProvider.JCO_ASHOST,
        "ls4065");
        connectProperties.setProperty(DestinationDataProvider.JCO_SYSNR,
        "85");
        connectProperties.setProperty(DestinationDataProvider.JCO_CLIENT,
        "800");
        connectProperties.setProperty(DestinationDataProvider.JCO_USER,
        "homo faber");
        connectProperties.setProperty(DestinationDataProvider.JCO_PASSWD,
        "alaska");
        connectProperties.setProperty(DestinationDataProvider.JCO_LANG,"en");
        createDestinationDataFile(DESTINATION_NAME1, connectProperties);
        connectProperties.setProperty(DestinationDataProvider.JCO_POOL_CAPACITY, "3");
        connectProperties.setProperty(DestinationDataProvider.JCO_PEAK_LIMIT, "10");
        createDestinationDataFile(DESTINATION_NAME2, connectProperties);
    }
    
    static void createDestinationDataFile(String destinationName, Properties connectProperties)
    {
        File destCfg = new File(destinationName+".jcoDestination");
        try
        {
            FileOutputStream fos = new FileOutputStream(destCfg,
            false);
            connectProperties.store(fos, "for tests only !");
            fos.close();
        }
        catch (Exception e)
        {
            throw new RuntimeException("Unable to create the destination files", e);
        }
    }

}
